package com.gui.components.search;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;

import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;

public class SearchTabelCellRenderer extends JLabel implements TableCellRenderer {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8309432427504828314L;

	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
		// TODO Auto-generated method stub
		if(value!=null)
		this.setText(value.toString());
		if(isSelected)
		{
			this.setForeground(Color.BLUE);
		}
		else
		{
			this.setForeground(Color.BLACK);
		}
	
		int fontSize;
		if(column==2)
		{
			fontSize=17;
			this.setHorizontalAlignment(JLabel.RIGHT);
			
		}
		else
		{
			fontSize=16;
			this.setHorizontalAlignment(JLabel.CENTER);
		}
		
		String fontName=this.getFont().getName();
		Font font=new Font(fontName,Font.BOLD,fontSize );
		this.setFont(font);
		return this;
	}

}
